package com.treasure.mall.biz.repository.order;

import com.treasure.mall.biz.base.JpaSearchableRepository;
import com.treasure.mall.biz.entity.order.DealOrderPO;
import com.treasure.mall.zbq.common.ienum.order.OrderEnums;
import org.springframework.stereotype.Repository;

/**
 * @author allan
 * @version 1.0.0
 * @date 2020/6/11
 */
@Repository
public interface DealOrderRepository extends JpaSearchableRepository<DealOrderPO, String> {

//    /**
//     * 检查用户已购买商品的数量
//     *  这个写法有问题
//     * @param userId
//     * @param goodsId
//     * @return
//     */
//    @Query("select sum(order.num) from OrderItemPO  order where order.subOrderPO.orderPO.userPO.userId = ?1 and order.goodsInfo.goodsId=?2")
//    long findByUserIdAndGoodsId(Long userId, Long goodsId);


    long countByUserPO_UserIdAndPayStatus(Long userId, OrderEnums.PayStatus payStatus);
}
